package utils

import (
	uuid "github.com/satori/go.uuid"
	"gopkg.in/ini.v1"
	"path/filepath"
)

//加载配置文件
func LoadConfigFile(configFilePath string) *ini.File {
	fileAbsPath, err := filepath.Abs(configFilePath)
	CheckErr(err)
	file, err := ini.Load(fileAbsPath)
	CheckErr(err)
	return file
}

const BaseFilePath = "/Users/yuliao.chen/data/"

func GetUUIDName(sourceName string) string {
	return uuid.NewV4().String() + ".jpg"
}

/**
待优化，.jpg 可以从fileName中获取
*/
func GetFilePath(fileName string) string {
	return BaseFilePath + fileName
}

func GetFileUrl(fileName string) string {
	return "http://localhost:8082/file/open/getFile?fileName=" + fileName
}
